package com.group.yztcedu.playlive.main.home;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.ImageView;

import com.group.yztcedu.playlive.R;
import com.group.yztcedu.playlive.config.UrlConfig;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

public class WebViewActivity extends AppCompatActivity {

    @BindView(R.id.webView_back_iv)
    ImageView webViewBackIv;
    @BindView(R.id.webView_wb)
    WebView webViewWb;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_web_view);
        ButterKnife.bind(this);
        WebSettings settings = webViewWb.getSettings();
        settings.setDefaultTextEncodingName("UTF-8");
        settings.setJavaScriptEnabled(true);
        settings.setAppCacheEnabled(true);
        settings.setDisplayZoomControls(true);
        settings.setSupportZoom(true);
        webViewWb.loadUrl(UrlConfig.HOME_WEBVIEW_URL);
        webViewWb.setWebViewClient(new WebViewClient() {
            @Override
            public boolean shouldOverrideUrlLoading(WebView view, String url) {
                webViewWb.loadUrl(url);
                return super.shouldOverrideUrlLoading(view, url);
            }
        });
    }
    @OnClick(R.id.webView_back_iv)
    public void onClick() {
        finish();
    }
}
